package com.study.common.config;

import cn.jpush.api.JPushClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
@ConfigurationProperties
public class JPushConfig {

    /**
     * 极光账号上的 AppKey
     */
    private static String appKey = "4b3b11e99057beb7ad2df440";

    /**
     * 极光账号上的 Master Secret
     */
    private static String secret = "597f62e4921ed2753f412f5c";

    private JPushClient jPushClient;

    /**
     * 客户端初始化时创建推送客户端
     *
     * @return
     */
    @PostConstruct
    public void initJPushClient() {
        jPushClient = new JPushClient(secret, appKey);
    }

    /**
     * 获取推送客户端
     *
     * @return
     */
    public JPushClient getjPushClient() {
        return jPushClient;
    }

}
